﻿using lite;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Collections;
using System.Data;
using System.Configuration;

namespace ZX.Test
{
    
    
    /// <summary>
    ///This is a test class for IDbTest and is intended
    ///to contain all IDbTest Unit Tests
    ///</summary>
    [TestClass()]
    public class IDbTest
    {
        private TestContext testContextInstance;
        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        internal virtual IDb CreateIDb()
        {
            // TODO: Instantiate an appropriate concrete class.
            lite.sqlserver.SqlProvider provider1 = new lite.sqlserver.SqlProvider(ConntionString);
            //System.Data.IDbConnection connection = new System.Data.SqlClient.SqlConnection("");
            IDb target = provider1.OpenDb();
            return target;
        }

        private string connectionString;
        public virtual string ConntionString
        {
            get
            {
                if (string.IsNullOrEmpty(connectionString))
                {
                    connectionString = ConfigurationSettings.AppSettings["ConnectionString"];
                }
                return connectionString;
            }
            set
            {
                connectionString = value;
            }
        }

        /// <summary>
        ///A test for Begin
        ///</summary>
        [TestMethod()]
        public void BeginTest()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            target.Begin();
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }

        /// <summary>
        ///A test for Call
        ///</summary>
        [TestMethod()]
        public void CallTest()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            string funcName = string.Empty; // TODO: Initialize to an appropriate value
            object[] parameters = null; // TODO: Initialize to an appropriate value
            object expected = null; // TODO: Initialize to an appropriate value
            object actual;
            actual = target.Call(funcName, parameters);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Commit
        ///</summary>
        [TestMethod()]
        public void CommitTest()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            target.Commit();
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }

        /// <summary>
        ///A test for Delete
        ///</summary>
        public void DeleteTestHelper<T>()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            ICollection<T> items = null; // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.Delete<T>(items);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        [TestMethod()]
        public void DeleteTest()
        {
            DeleteTestHelper<GenericParameterHelper>();
        }

        /// <summary>
        ///A test for Delete
        ///</summary>
        [TestMethod()]
        public void DeleteTest1()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            Type type = null; // TODO: Initialize to an appropriate value
            ICollection items = null; // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.Delete(type, items);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Delete
        ///</summary>
        [TestMethod()]
        public void DeleteTest2()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            object item = null; // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.Delete(item);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Delete
        ///</summary>
        public void DeleteTest3Helper<T>()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            IQuery query = null;      // TODO: Initialize to an appropriate value
            int expected = 0;         // TODO: Initialize to an appropriate value
            int actual;
            actual = target.Delete<T>(query);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        [TestMethod()]
        public void DeleteTest3()
        {
            DeleteTest3Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///A test for Delete
        ///</summary>
        [TestMethod()]
        public void DeleteTest4()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            Type type = null; // TODO: Initialize to an appropriate value
            IQuery query = null; // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.Delete(type, query);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Exec
        ///</summary>
        [TestMethod()]
        public void ExecTest()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            string procName = string.Empty; // TODO: Initialize to an appropriate value
            object[] parameters = null; // TODO: Initialize to an appropriate value
            IResultSet expected = null; // TODO: Initialize to an appropriate value
            IResultSet actual;
            actual = target.Exec(procName, parameters);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Exec
        ///</summary>
        [TestMethod()]
        public void ExecTest1()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            Type type = null; // TODO: Initialize to an appropriate value
            string procName = string.Empty; // TODO: Initialize to an appropriate value
            object[] parameters = null; // TODO: Initialize to an appropriate value
            IList expected = null; // TODO: Initialize to an appropriate value
            IList actual;
            actual = target.Exec(type, procName, parameters);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Exec
        ///</summary>
        [TestMethod()]
        public void ExecTest2()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            string procName = string.Empty; // TODO: Initialize to an appropriate value
            object[] parameters = null; // TODO: Initialize to an appropriate value
            int[] outputs = null; // TODO: Initialize to an appropriate value
            IResultSet expected = null; // TODO: Initialize to an appropriate value
            IResultSet actual;
            actual = target.Exec(procName, parameters, outputs);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Find
        ///</summary>
        [TestMethod()]
        public void FindTest()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            Type type = null; // TODO: Initialize to an appropriate value
            object key = null; // TODO: Initialize to an appropriate value
            object expected = null; // TODO: Initialize to an appropriate value
            object actual;
            actual = target.Find(type, key);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Find
        ///</summary>
        public void FindTest1Helper<T>()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            object key = null; // TODO: Initialize to an appropriate value
            T expected = default(T); // TODO: Initialize to an appropriate value
            T actual;
            actual = target.Find<T>(key);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        [TestMethod()]
        public void FindTest1()
        {
            FindTest1Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///A test for GetTable
        ///</summary>
        [TestMethod()]
        public void GetTableTest()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            Type type = null; // TODO: Initialize to an appropriate value
            ITable expected = null; // TODO: Initialize to an appropriate value
            ITable actual;
            actual = target.GetTable(type);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Insert
        ///</summary>
        [TestMethod()]
        public void InsertTest()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            object item = null; // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.Insert(item);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Insert
        ///</summary>
        public void InsertTest1Helper<T>()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            ICollection<T> items = null; // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.Insert<T>(items);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        [TestMethod()]
        public void InsertTest1()
        {
            InsertTest1Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///A test for Insert
        ///</summary>
        [TestMethod()]
        public void InsertTest2()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            Type type = null; // TODO: Initialize to an appropriate value
            ICollection items = null; // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.Insert(type, items);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Query
        ///</summary>
        [TestMethod()]
        public void QueryTest()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            IQuery expected = null; // TODO: Initialize to an appropriate value
            IQuery actual;
            actual = target.Query();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Rollback
        ///</summary>
        [TestMethod()]
        public void RollbackTest()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            target.Rollback();
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }

        /// <summary>
        ///A test for Select
        ///</summary>
        [TestMethod()]
        public void SelectTest()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            Type type = null; // TODO: Initialize to an appropriate value
            IQuery query = null; // TODO: Initialize to an appropriate value
            IList expected = null; // TODO: Initialize to an appropriate value
            IList actual;
            actual = target.Select(type, query);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Select
        ///</summary>
        public void SelectTest1Helper<T>()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            IQuery query = null; // TODO: Initialize to an appropriate value
            IList<T> expected = null; // TODO: Initialize to an appropriate value
            IList<T> actual;
            actual = target.Select<T>(query);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        [TestMethod()]
        public void SelectTest1()
        {
            SelectTest1Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///A test for Update
        ///</summary>
        [TestMethod()]
        public void UpdateTest()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            object item = null; // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.Update(item);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Update
        ///</summary>
        public void UpdateTest1Helper<T>()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            ICollection<T> items = null; // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.Update<T>(items);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        [TestMethod()]
        public void UpdateTest1()
        {
            UpdateTest1Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///A test for Update
        ///</summary>
        [TestMethod()]
        public void UpdateTest2()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            Type type = null; // TODO: Initialize to an appropriate value
            ICollection items = null; // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.Update(type, items);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Connection
        ///</summary>
        [TestMethod()]
        public void ConnectionTest()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            IDbConnection actual;
            actual = target.Connection;
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for IsAutoCommit
        ///</summary>
        [TestMethod()]
        public void IsAutoCommitTest()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            bool actual;
            actual = target.IsAutoCommit;
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for IsClosed
        ///</summary>
        [TestMethod()]
        public void IsClosedTest()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            bool actual;
            actual = target.IsClosed;
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Transaction
        ///</summary>
        [TestMethod()]
        public void TransactionTest()
        {
            IDb target = CreateIDb(); // TODO: Initialize to an appropriate value
            IDbTransaction actual;
            actual = target.Transaction;
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
    }
}
